#include "Zoomable.hpp"

namespace sl
{
	Zoomable::Zoomable(float zoomlevel) : myZoomLevel(zoomlevel, zoomlevel)
	{}

	Zoomable::Zoomable(const sf::Vector2f& zoomlevel) : myZoomLevel(zoomlevel)
	{}

	Zoomable::~Zoomable()
	{}

	Zoomable* Zoomable::SetZoomLevel(float zoomlevel)
	{
		return SetZoomLevel(sf::Vector2f(zoomlevel, zoomlevel));
	}

	Zoomable* Zoomable::SetZoomLevel(const sf::Vector2f& zoomlevel)
	{
		ResetZoom();
		myZoomLevel = zoomlevel;
		Zoom(myZoomLevel);
		return this;
	}

	sf::Vector2f Zoomable::GetZoomLevel()
	{
		return myZoomLevel;
	}

	Zoomable* Zoomable::AddZoomLevel(float zoomlevel)
	{
		myZoomLevel = myZoomLevel * zoomlevel;
		Zoom(myZoomLevel);
		return this;
	}

	Zoomable* Zoomable::AddZoomLevel(const sf::Vector2f& zoomlevel)
	{
		myZoomLevel = sf::Vector2f(myZoomLevel.x * zoomlevel.x, myZoomLevel.y * zoomlevel.y);
		Zoom(myZoomLevel);
		return this;
	}

	Zoomable* Zoomable::ResetZoom()
	{
		Zoom(sf::Vector2f(1 / myZoomLevel.x, 1 / myZoomLevel.y));
		myZoomLevel = sf::Vector2f(1.f, 1.f);
		return this;
	}

	Zoomable* Zoomable::Zoom(float zoomlevel)
	{
		return this;
	}

	Zoomable* Zoomable::Zoom(const sf::Vector2f& zoomlevel)
	{
		return this;
	}
}